/*
 * Copyright (c) 2001-2018 GuaHao.com Corporation Limited. All rights reserved.
 * This software is the confidential and proprietary information of GuaHao Company.
 * ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use it only
 * in accordance with the terms of the license agreement you entered into with GuaHao.com.
 */

package com.bolt.convention.data.code;


import com.bolt.convention.exception.ServiceException;

/**
 * 服务错误码接口
 * @author freeway
 */
public interface ServiceCode extends ResultCode {

    /**
     * 返回服务异常
     * @return Service Exception
     */
    default ServiceException failure() {
        return new ServiceException(this);
    }

    /**
     * 返回服务异常
     * @param cause 原始异常
     * @return Service Exception
     */
    default ServiceException failure(Throwable cause) {
        return new ServiceException(this, cause);
    }
}
